
<template>
  <base-page-view class-name="page-container">
    <view class="top">
      <view class="top-bg">
        <b-image width="750" height="430" is-asset src="/static/images/mine/bg_earing_black.png" />
      </view>
      <view class="top-content">
        <view class="js_center price">{{ assistant.total | formatMoney(2,true) }}</view>
        <view class="title js_center" @click="question(1)">累计收益(元)
          <image src="/static/images/icon/icon_question_white.png" class="question" />
        </view>
      </view>
      <!-- <span class="js_center mention history">干的漂亮！请继续加油~</span> -->
    </view>
    <view class="center">
      <view class="todayEarnings">
        <view class="title">累计发放
          <!-- <image src="/static/images/mine/question.png" class="question" @click="question(2)" /> -->
        </view>
        <!-- ¥ -->
        <view class="info">
          <view class="price"><span class="icon"></span>{{ assistant.withdraw | formatMoney(2,true) }}</view>
        </view>
      </view>
      <view class="todayEarnings bottom20">
        <view class="title">累计自购减免
          <!-- <image src="/static/images/mine/question.png" class="question" @click="question(3)" /> -->
        </view>
        <view class="info">
          <view class="price"><span class="icon"></span>{{ assistant.preferential | formatMoney(2,true) }}</view>
        </view>
      </view>
      <view class="todayEarnings bottom20" @click="$navigateTo('/pagesCommission/earnings/confirmDetails?orderStatus='+0+'&totalMoney='+assistant.confirmedWithdraw)">
        <view class="title">已发货商品收益
          <!-- <image src="/static/images/mine/question.png" class="question" @click="question(5)" /> -->
        </view>
        <view class="info">
          <view class="price"><span class="icon">¥</span>{{ assistant.confirmedWithdraw | formatMoney(2,true) }}</view>
        </view>
        <image src="/static/images/icon/icon_arror_right_grey.png" class="list_more" />
      </view>
      <view class="todayEarnings bottom20" @click="$navigateTo('/pagesCommission/earnings/confirmDetails?orderStatus='+2+'&totalMoney='+assistant.unWithdraw)">
        <view class="title">未发货商品收益
          <!-- <image src="/static/images/mine/question.png" class="question" @click="question(4)" /> -->
        </view>
        <view class="info">
          <view class="price"><span class="icon">¥</span>{{ assistant.unWithdraw | formatMoney(2,true) }}</view>
        </view>
        <image src="/static/images/icon/icon_arror_right_grey.png" class="list_more" />
      </view>
    </view>
  </base-page-view>
</template>

<script>
import './index.scss'
export default {
  components: {
  },
  data() {
    return {
      assistant: {}
    }
  },
  created() {
  },
  onLoad(option) {
    this.initData()
  },
  onShow() {
  },
  methods: {
    async initData() {
      const res = await this.$api.commissionApi.getUserEarning({ userId: this.$store.state.userInfo.uid })
      if (res.code === '000000') {
        this.assistant = res.data
      }
      console.log(res)
    },
    question(type) {
      let message = ''
      let title = ''
      if (type === 1) {
        message = `1、累计收益：指碧选自营零售类商品，所得收益之和。累计收益=累计发放+累计自购减免+已发货商品收益+未发货商品收益<br/>
          2、累计发放：指已发放的收益<br/>
          3、累计自购减免：指碧选会员身份所享受的优惠减免金额之和<br/>
          4、已发货商品收益：指“已发货商品”的待发放收益<br/>
          5、未发货商品收益：指“未发货商品”将产生的收益`
        title = '收益说明'
      } else if (type === 2) {
        message = '指已发放的收益。'
        title = '累计发放'
      } else if (type === 3) {
        message = '指碧选会员身份所享受的优惠减免金额之和。'
        title = '累计优惠'
      } else if (type === 4) {
        message = '指正在核查 “未发货商品”的收益。'
        title = '待确认'
      } else if (type === 5) {
        message = '指已核查确认“已发货商品”的待发放收益。'
        title = '已确认'
      }
      this.$gc.$message({
        content: message,
        title: title,
        type: 'richText',
        showMessage: true,
        showCancel: false,
        confirmText: '好哒',
        align: 'left'
      })
    }
  }
}
</script>
